package com.lin.cloud.disk.service.impl;

import com.lin.cloud.disk.entity.pojo.Permission;
import com.lin.cloud.disk.entity.response.PermissionGroupListResponse;
import com.lin.cloud.disk.service.IPermissionService;
import com.lin.cloud.disk.mapper.PermissionMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * (Permission)表服务实现类
 *
 * @author ljc
 * @since 2020-12-10 16:44:58
 */
@Service
@Slf4j
public class PermissionServiceImpl implements IPermissionService {

    @Resource
    private PermissionMapper permissionMapper;

    /**
     * 通过权限ID列表查询权限列表
     * @param permissionIdList
     * @return
     */
    @Override
    public List<Permission> selectPermissionListByPermissionIdList(List<Long> permissionIdList) {
        return permissionMapper.selectPermissionListByPermissionIdList(permissionIdList);
    }

    /**
     * 所有的权限
     * @return
     */
    @Override
    public PermissionGroupListResponse allPermissionList(){
        List<Permission> permissionList = permissionMapper.allPermissionList();
        return new PermissionGroupListResponse(permissionList);
    }
}